Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
I want to know what this line of code mean: /[a-zA-Z]/

I want to move the first character of a string to the end and then add "ay" to it, I tried to solve it but I couldn't and then I found this solution. can you please explain to me the logic in this code.

function pigIt(str){
  str = str.split(' ');
  for(let i = 0;i<str.length;i++){
    if(/[a-zA-Z]/.test(str[i])){
      str[i] = str[i].slice(1) + str[i][0] + 'ay';
    } 

  }
  return str.join(' ');
}
console.log(pigIt('Pig latin is cool'));

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!